# 本次项目基本dockerfile配置项
# 基础镜像
FROM nginx:1.17.6

# 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面
ADD  dist/ /usr/share/nginx/html

## 将本地的nginx配置文件拷贝到容器对应位置，使其生效
#COPY ./pandora-test/default.conf.bak /etc/nginx/conf.d/default.conf.bak
#
##CMD envsubst '$n_proxy_pass $n_proxy_port' < ./pandora-test/nginx.conf.template > /etc/nginx/conf.d/nginx.conf.template && nginx -g 'daemon off;'
#
##CMD ["/bin/bash -c", "envsubst '$n_proxy_pass $n_proxy_port' < ./pandora-test/nginx.conf.template > /etc/nginx/conf.d/nginx.conf.template && nginx -g 'daemon off;'"]

RUN rm -rf /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/nginx.conf
ENV N_PROXY_PASS 127.0.0.1
ENV N_PROXY_PORT 8181
ENV IMG_PROXY_PASS 192.168.1.230
ENV IMG_PROXY_PORT 8080

ADD ./docker/nginx.conf.template /etc/nginx/conf.d/nginx.conf.template
#ADD dist /app/html/dist
CMD ["/bin/bash", "-c", "envsubst '$N_PROXY_PASS $N_PROXY_PORT $IMG_PROXY_PASS $IMG_PROXY_PORT' < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/nginx.conf && exec nginx -g 'daemon off;'"]